#include <rtthread.h>
#include <stdint.h>
#include <rtdevice.h>
#include <board.h>
#include "gt911.h"

#define GT911_RST_PIN   41  /*PB9*/
#define GT911_IRQ_PIN   40  /*PB8*/

int rt_hw_gt911_port(void)
{
    struct rt_touch_config cfg;
    rt_uint8_t rst_pin;

    rst_pin = GT911_RST_PIN;
    cfg.dev_name = "i2c0";
    cfg.irq_pin.pin = GT911_IRQ_PIN;
    cfg.irq_pin.mode = PIN_MODE_INPUT_PULLDOWN;
    cfg.user_data = &rst_pin;

    extern int gt911_sample(const char *name, rt_uint16_t x, rt_uint16_t y);
    rt_hw_gt911_init("gt911", &cfg);

    rt_uint16_t x=0;
    rt_uint16_t y=0;
    gt911_sample("gt911", 0, 0);

    return 0;
}
INIT_APP_EXPORT(rt_hw_gt911_port);